package cn.liu;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = RabbitMQApplication.class)
public class SendTest {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void testSend() throws InterruptedException {
        //参数：交换机 ，队列的routingkey ，消息内容
        rabbitTemplate.convertAndSend(
                RabbitMQConfig.NAME_EXCHANGE_TOPICS_1010,
                "sms.code",
                "TEST-1"
        );
        Thread.sleep(5000);
    }
}
